package model;

import java.util.*;
/**
 * A template used to create the hotel rooms.   
 * 
 * @author Kenny Chong, Dan End, James Ju
 * CSE 333 : User Interface
 * Project HMSystem
 */
public class Room {
	
	// Track number of occupants in the room.
	private ArrayList<Guests> guestList;
	
	// What is the room type? 
	private RoomType type;
	
	// What floor is it located?
	private Floor floor;
	
	// Is it occupied?
	private boolean occupied;
	
	// Is it cleaned?
	private boolean cleaned;
	
	// The X and Y coordinates.
	private int xCoor;
	private int yCoor;
	
	// Room name.
	private String roomName;
	
	/**
	 * Construct room.
	 * @param type
	 */
	public Room(RoomType type, Floor floor)
	{
		this.type = type;
		
		this.floor = floor;
		
		// Initialize guestList.
		guestList = new ArrayList<Guests>();
		
		occupied = false;
		cleaned = true;
		
		xCoor = 0;
		yCoor = 0;
	}
	
	/**
	 * Construct room with x and y positions and room name.
	 * @return
	 */
	public Room(RoomType type, Floor floor, String roomName, int x, int y)
	{
		this.type = type;
		
		this.floor = floor;
		
		// Initialize guestList.
		guestList = new ArrayList<Guests>();
		
		// Initialize x and y coordinate values.
		this.xCoor = x;
		this.yCoor = y;
		
		// Initialize roomName.
		this.roomName = roomName;
		
		occupied = false;
		cleaned = true;
	}

	// Setters and getters.
	public int getXCoordinate()
	{
		return xCoor;
	}
	
	public int getYCoordinate()
	{
		return yCoor;
	}
	
	public void setXCoordinate(int xCoor)
	{
		this.xCoor = xCoor;
	}
	
	public void setYCoordinate(int yCoor)
	{
		this.yCoor = yCoor;
	}
	
	public String getRoomName()
	{
		return roomName;
	}
	
	public void setRoomName(String roomName)
	{
		this.roomName = roomName;
	}
	
	public Guests getGuestByName(String name)
	{
		return null;
	}
	
	public Guests removeGuestByName(String name)
	{
		return null;
	}
	
	public boolean removeAllGuests()
	{
		return true;
	}
	
	public RoomType getRoomType()
	{
		return type;
	}
	
	public void setRoomType(RoomType type)
	{
		this.type = type;
	}
	
	public boolean isOccupied()
	{
		return occupied;
	}
	
	public void setOccupied(boolean occupied)
	{
		this.occupied = occupied;
	}
	
	public boolean isCleaned()
	{
		return cleaned;
	}
	
	public void setCleaned(boolean cleaned)
	{
		this.cleaned = cleaned;
	}
	
	public ArrayList<Guests> getGuestList()
	{
		return guestList;
	}
	
	public void addGuestToRoom(Guests guest)
	{
		guestList.add(guest);
		occupied = true;
	}
	
	public String toString()
	{
		return roomName + "\n" +
	           "Room Type: " + type + "\n" +
			   "Occupied: " + occupied + "\n" +
			   "# Of Guests: " + guestList.size();
	}
}
